package sealte.test.crazyjavalearning.test.AOP;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MyInvokationHandler implements InvocationHandler {

	private Object target;
	
	public void setTarget(Object target){
		this.target = target;
	}
	
	@Override
	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		String methodName = method.getName();
		if(methodName.equals("jump")){
			
		}else if(methodName.equals("run")){
			
		}else{
			
		}
		
		Boolean flag = (Boolean)args[0];
		if(flag.booleanValue()){
			args[0] = new Boolean(false);
		}else{
			args[0] = new Boolean(true);
		}
		
		return method.invoke(target, args);
	}

}
